﻿@model Nop.Web.Models.Catalog.ProductsByTagModel
@{
    Layout = "~/Views/Shared/_ColumnsThree.cshtml";

    //title
    Html.AddTitleParts(string.Format(T("PageTitle.ProductsByTag").Text, Model.TagName));
}
@using Nop.Core;
@using Nop.Core.Infrastructure;
@using Nop.Web;
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using Nop.Web.Extensions;
<div class="producttag-page">
    <div class="page-title">
        <h1>@String.Format(T("Products.Tags.ProductsTaggedWith").Text, Model.TagName)</h1>
    </div>

    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "productsbytag_top" })

    <div class="category-products">
        <div class="product-pager-and-sorter-and-view-options-7Spikes">
            <div class="product-pager-and-size">
                @*pager*@
                <div class="pager">
                    @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
                </div>
                @*page size*@
                @if (Model.PagingFilteringContext.AllowCustomersToSelectPageSize && Model.Products.Count > 0)
                {
                    <div class="product-page-size">
                        <span>@T("Categories.PageSize")</span> <span>@Html.DropDownList("products-pagesize", Model.PagingFilteringContext.PageSizeOptions, new { onchange = "setLocation(this.value);" })</span>
                        <span>@T("Categories.PageSize.PerPage")</span>
                    </div>
                }
            </div>
            <div class="product-sorting-and-view-options">
                @*view mode*@
                @if (Model.PagingFilteringContext.AllowProductViewModeChanging && Model.Products.Count > 0)
                {
                    <div class="product-viewmode">
            <span>@T("Categories.ViewMode")</span>
                        @Html.DropDownList("products-viewmode", Model.PagingFilteringContext.AvailableViewModes, new { onchange = "setLocation(this.value);" })
                    </div>
                }    
@*sorting*@
                @if (Model.PagingFilteringContext.AllowProductSorting && Model.Products.Count > 0)
                {
                    <div class="product-sorting">
            <span>@T("Categories.OrderBy")</span>
                        @Html.DropDownList("products-orderby", Model.PagingFilteringContext.AvailableSortOptions, new { onchange = "setLocation(this.value);" })
                    </div>
                }
            </div>
        </div>
        <div class="clear">
        </div>

        @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "productsbytag_before_product_list" })

        @*product list*@
        @if (Model.Products.Count > 0)
        {
            if (Model.PagingFilteringContext.ViewMode == "list")
            {
@*list mode*@
            <div class="product-list">
                @foreach (var product in Model.Products)
                {
                    <div class="item-box">
                        @Html.Partial("_ProductBox", product)
                    </div>
                }
            </div>     
            }
            else
            {
@*grid mode*@
            <div class="product-grid">
                @(Html.DataList<ProductOverviewModel>(Model.Products, 3,
                    @<div class="item-box">
                        @Html.Partial("_ProductBox", @item)
                    </div>
                ))
            </div>
            }
        }
        @if (Model.PagingFilteringContext.TotalPages > 1)
        {
            <div class="product-pager-and-sorter-and-view-options-7Spikes">
                <div class="product-pager-and-size">
                    @*pager*@
                    <div class="pager">
                        @Html.Pager(Model.PagingFilteringContext).QueryParam("pagenumber")
                    </div>
                </div>
            </div>
        }
    </div>

    @Html.Action("WidgetsByZone", "Widget", new { widgetZone = "productsbytag_bottom" })

</div>
